-
-
Notifications
You must be signed in to change notification settings - Fork 320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add hyperlinks to accounts and dates in HTML and FODS export #2226
Add hyperlinks to accounts and dates in HTML and FODS export #2226
Conversation
The feature could also be used in |
Interesting feature!
I don't know the url escaping function offhand but it sounds resolvable. Maybe there's ideas in hledger-web. The reverse feature (linking to static HTML reports) could be a separate PR. I'd like to have multi-period tabular reports as a normal view in hledger-web, but linking to static html reports saved in temporary files, or better, serving the static html generated in memory, might be easier. |
On Thu, 12 Sep 2024, Simon Michael wrote:
Interesting feature!
--base-url sounds good. I assume its value will be the same as what hledger-web prints at startup ? Eg
...
with base url http://127.0.0.1:5000
...
I expect the trailing slash to be part of the base URL.
I don't know the url escaping function offhand but it sounds resolvable.
Maybe there's ideas in hledger-web.
hledger-web generates HTML via `blaze` instead of `lucid`.
The reverse feature (linking to static HTML reports) could be a separate PR.
of course
I'd like to have multi-period tabular reports as a normal view in
hledger-web, but linking to static html reports saved in temporary
files, or better, serving the static html generated in memory, might be
easier.
Hledger.Write.Html.printHTML returns a Lucid.Html () which can be served
from memory or written to a file.
|
be469c8
to
3b01812
Compare
We could also add the query from the command-line to the hyperlinks. That is, if someone restricts transactions in a certain way for the |
c2f4575
to
2cc730a
Compare
Sorry it has taken a while to get back to this, I have been backlogged. I have no objection to this. Do you use it much ? Is it implemented only for the |
On Tue, 24 Sep 2024, Simon Michael wrote:
I have no objection to this. Do you use it much ?
Not yet. I guess, it would see more use if integrated in hledger-web.
Is it implemented only for the balance command right now ?
Yes. What other commands could benefit from the feature?
|
63f1671
to
53bdfe9
Compare
Things added to the balance command can often also apply to the balancesheet, balancesheetequity, cashflow, and incomestatement commands; they share many options and features. Sometimes I call them collectively "balcmds".
Oh, if the HTML balance reports were directly served within hledger-web ? I agree that would be nice. |
On Wed, 25 Sep 2024, Simon Michael wrote:
Things added to the balance command can often also apply to the
balancesheet, balancesheetequity, cashflow, and incomestatement
commands; they share many options and features. Sometimes I call them
collectively "balcmds".
I guess supporting these commands happens in CompoundBalanceCommand.
it would see more use if integrated in hledger-web.
Oh, if the HTML balance reports were directly served within hledger-web ?
exactly
|
That's right. |
7aa8a27
to
3cf2c09
Compare
In |
3cf2c09
to
3116515
Compare
CI build fails because of missing module |
3116515
to
5ae2d75
Compare
The balance query is now passed to the cell anchor URLs. |
I think I have now resolved the URL escaping issue using the package |
cli: Commands.Balance: new option --base-url It adds hledger-web-compatible hyperlinks to account names.
… anchors to period headers
4da79d3
to
35f2709
Compare
Thank you very much! Let's try this and keep it as long as it's useful. I'll mark it experimental to start with. |
On Sun, 29 Sep 2024, Simon Michael wrote:
Let's try this and keep it as long as it's useful. I'll mark it
experimental to start with.
I have just proposed an extension to hledger-web that uses those links.
With this extension, the hyperlinks in balance reports become very handy.
|
Nice.
Could you explain this to me a bit more ? |
Ie, can we make it not care whether they write a slash or not ? Where would relative links come in. |
On Sun, 29 Sep 2024, Simon Michael wrote:
Ie, can we make it not care whether they write a slash or not ? Where would relative links come in.
I use relative links in my Balance Report extension in hledger-web. The
links just read "register?q=date:2024". No slash involved. It is
equivalent to the command line option --base-url="".
|
I see the PR but I haven't run it locally yet and I don't quite understand. Can we eg add the trailing/separating slash automatically when needed ? |
On Sun, 29 Sep 2024, Simon Michael wrote:
Ie, can we make it not care whether they write a slash or not ?
I could add a slash whenever base-url is non-empty and not terminated with
a slash. This way, --base-url="" would enable relative links and
--base-url=/ would enable server-absolute links. Additionally,
--base-url=simple would not result in links like
"simpleregister?q=date:2024".
|
That sounds great. I'd just like to not make users work harder than needed. |
If possible I'd like to clean up this slash thing before the next wave of PR merges. I have a few small followups to this one. If you prefer, I can help with the slash. No urgency. |
On Sun, 29 Sep 2024, Simon Michael wrote:
If possible I'd like to clean up this slash thing before the next wave
of PR merges. I have a few small followups to this one. If you prefer, I
can help with the slash. No urgency.
The slash issue is already fixed in commit
1024ad90135db74a02374d9e23cdb4875a23346e.
|
Great! Uh, in what pr or branch do I find that ? |
That commit was not yet pushed. Take this one instead: |
Will do, when I figure out how. :) |
Ah, I think the PR was made against your own master by mistake: thielema#3 . I can get it from there. |
On Sun, 29 Sep 2024, Simon Michael wrote:
Will do, when I figure out how. :)
I opened a regular pull request:
#2245
|
I think this will be enough.
Thank you! This and followups pushed to master. |
This adds the option
--anchor
tohledger-cli
. If the user passes this option, then in HTML and FODS output the account and date header cells become hyperlinks tohledger-web
.If you like this feature, I add some documentation.
I could also rename the option to
--base-url
for consistency withhledger-web
.There is a problem though. Some special characters like
+
or umlauts in account names are not correctly escaped in percent URL syntax by Lucid. I do not know how to solve this correctly with Lucid and whether it is solvable with Lucid, at all.